<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 去掉重复的字符
        var str = 'aabccd';

        // 转数组
        var arr = str.split('')
        // 去重,再用join('')进行转字符
        var res = arr.reduce(function(pic,cur){
            return (pic.indexOf(cur) === -1) ? pic.concat(cur) : pic;
        },[]).join('')
    </script>
</body>
</html>